package com.huayun.dcsp.configclient.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.huayun.dcsp.configclient.service.TestService;

@RefreshScope
@RestController
class TestController {

    @Value("${from}")
    private String from;

    @RequestMapping("/from")
    public String from() {

        return this.from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getFrom() {
        return from;
    }
    
    @Value("${ratio}")
    private Integer ratio;

    @RequestMapping("/ratio")
    public Integer ratio() {

        return this.ratio;
    }

    public void setRatio(Integer ratio) {
        this.ratio = ratio;
    }

    public Integer getRatio() {
        return ratio;
    }
    
    @Autowired
    private TestService testService;
    
    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public String add() {
    	return testService.add();
    }

}